package edu.ynu.e_platform.controllers;

import edu.ynu.e_platform.common.controller.LogicController;
import edu.ynu.e_platform.dao.ItemDao;
import edu.ynu.e_platform.entities.Item;
import edu.ynu.e_platform.service.ItemService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * @author manwen Yang
 */
@Slf4j
@Tag(name = "商品 实体控制器")
@RestController
@RequestMapping("/item")
public class ItemController
        extends LogicController<ItemService, ItemDao, Item, Long> {
    public ItemController(@Autowired ItemService ls) {
        super(ls);
    }

    @PostMapping("/updateImg")
    @Operation(summary = "更新图片")
    public String updateImg(Long itemId, MultipartFile file){
        return getService().updateImg(itemId, file);
    }
}
